/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package bean;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author mezouari
 */
@Entity
@Table(name = "vehicule")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Vehicule.findAll", query = "SELECT v FROM Vehicule v"),
    @NamedQuery(name = "Vehicule.findById", query = "SELECT v FROM Vehicule v WHERE v.id = :id"),
    @NamedQuery(name = "Vehicule.findByImmatriculation", query = "SELECT v FROM Vehicule v WHERE v.immatriculation = :immatriculation"),
    @NamedQuery(name = "Vehicule.findByMarque", query = "SELECT v FROM Vehicule v WHERE v.marque = :marque"),
    @NamedQuery(name = "Vehicule.findByKilometrage", query = "SELECT v FROM Vehicule v WHERE v.kilometrage = :kilometrage"),
    @NamedQuery(name = "Vehicule.findByCategorie", query = "SELECT v FROM Vehicule v WHERE v.categorie = :categorie"),
    @NamedQuery(name = "Vehicule.findByCarburant", query = "SELECT v FROM Vehicule v WHERE v.carburant = :carburant"),
    @NamedQuery(name = "Vehicule.findByTransmission", query = "SELECT v FROM Vehicule v WHERE v.transmission = :transmission"),
    @NamedQuery(name = "Vehicule.findByEtat", query = "SELECT v FROM Vehicule v WHERE v.etat = :etat"),
    @NamedQuery(name = "Vehicule.findByModele", query = "SELECT v FROM Vehicule v WHERE v.modele = :modele"),
    @NamedQuery(name = "Vehicule.findByCouleur", query = "SELECT v FROM Vehicule v WHERE v.couleur = :couleur"),
    @NamedQuery(name = "Vehicule.findByPrix", query = "SELECT v FROM Vehicule v WHERE v.prix = :prix")})
public class Vehicule implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "Id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "Immatriculation")
    private String immatriculation;
    @Basic(optional = false)
    @Column(name = "Marque")
    private String marque;
    @Basic(optional = false)
    @Column(name = "Kilometrage")
    private double kilometrage;
    @Basic(optional = false)
    @Column(name = "Categorie")
    private String categorie;
    @Basic(optional = false)
    @Column(name = "Carburant")
    private String carburant;
    @Basic(optional = false)
    @Column(name = "Transmission")
    private String transmission;
    @Basic(optional = false)
    @Column(name = "Etat")
    private String etat;
    @Basic(optional = false)
    @Column(name = "Modele")
    private String modele;
    @Basic(optional = false)
    @Column(name = "Couleur")
    private String couleur;
    @Basic(optional = false)
    @Column(name = "Prix")
    private double prix;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idVehicule")
    private List<Vignite> vigniteList;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "immatriculation")
    private Assurance assurance;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idVehicule")
    private List<Visitetechnique> visitetechniqueList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idVehicule")
    private List<Panne> panneList;
    @JoinColumn(name = "IdOption", referencedColumnName = "Id")
    @ManyToOne(optional = false)
    private Optionsupplimentaire idOption;
    @JoinColumn(name = "IdPromotion", referencedColumnName = "Id")
    @ManyToOne(optional = false)
    private Promotion idPromotion;

    public Vehicule() {
    }

    public Vehicule(Integer id) {
        this.id = id;
    }

    public Vehicule(Integer id, String immatriculation, String marque, double kilometrage, String categorie, String carburant, String transmission, String etat, String modele, String couleur, double prix) {
        this.id = id;
        this.immatriculation = immatriculation;
        this.marque = marque;
        this.kilometrage = kilometrage;
        this.categorie = categorie;
        this.carburant = carburant;
        this.transmission = transmission;
        this.etat = etat;
        this.modele = modele;
        this.couleur = couleur;
        this.prix = prix;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getImmatriculation() {
        return immatriculation;
    }

    public void setImmatriculation(String immatriculation) {
        this.immatriculation = immatriculation;
    }

    public String getMarque() {
        return marque;
    }

    public void setMarque(String marque) {
        this.marque = marque;
    }

    public double getKilometrage() {
        return kilometrage;
    }

    public void setKilometrage(double kilometrage) {
        this.kilometrage = kilometrage;
    }

    public String getCategorie() {
        return categorie;
    }

    public void setCategorie(String categorie) {
        this.categorie = categorie;
    }

    public String getCarburant() {
        return carburant;
    }

    public void setCarburant(String carburant) {
        this.carburant = carburant;
    }

    public String getTransmission() {
        return transmission;
    }

    public void setTransmission(String transmission) {
        this.transmission = transmission;
    }

    public String getEtat() {
        return etat;
    }

    public void setEtat(String etat) {
        this.etat = etat;
    }

    public String getModele() {
        return modele;
    }

    public void setModele(String modele) {
        this.modele = modele;
    }

    public String getCouleur() {
        return couleur;
    }

    public void setCouleur(String couleur) {
        this.couleur = couleur;
    }

    public double getPrix() {
        return prix;
    }

    public void setPrix(double prix) {
        this.prix = prix;
    }

    @XmlTransient
    public List<Vignite> getVigniteList() {
        return vigniteList;
    }

    public void setVigniteList(List<Vignite> vigniteList) {
        this.vigniteList = vigniteList;
    }

    public Assurance getAssurance() {
        return assurance;
    }

    public void setAssurance(Assurance assurance) {
        this.assurance = assurance;
    }

    @XmlTransient
    public List<Visitetechnique> getVisitetechniqueList() {
        return visitetechniqueList;
    }

    public void setVisitetechniqueList(List<Visitetechnique> visitetechniqueList) {
        this.visitetechniqueList = visitetechniqueList;
    }

    @XmlTransient
    public List<Panne> getPanneList() {
        return panneList;
    }

    public void setPanneList(List<Panne> panneList) {
        this.panneList = panneList;
    }

    public Optionsupplimentaire getIdOption() {
        return idOption;
    }

    public void setIdOption(Optionsupplimentaire idOption) {
        this.idOption = idOption;
    }

    public Promotion getIdPromotion() {
        return idPromotion;
    }

    public void setIdPromotion(Promotion idPromotion) {
        this.idPromotion = idPromotion;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Vehicule)) {
            return false;
        }
        Vehicule other = (Vehicule) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "bean.Vehicule[ id=" + id + " ]";
    }
    
}
